package com.mogu.biguser.domain;

import com.mogu.biguser.common.constant.DictMap;
import com.mogu.biguser.common.entity.Manager;

import java.io.Serializable;
import java.util.List;

/**
 * Description: 后台运维管理员信息
 */
public class ManagerInfo extends Manager implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 状态
	 */
	private String stateStr;

	/**
	 * 一个管理员具有多个角色
	 */
	private List<SysRole> roles;// 一个用户具有多个角色

	public ManagerInfo() {
	}

	public List<SysRole> getRoles() {
		return roles;
	}

	public void setRoles(List<SysRole> roles) {
		this.roles = roles;
	}

	/**
	 * 密码盐
	 */
	public String getCredentialsSalt() {
		return getUsername() + getSalt();
	}

	@Override
	public String toString() {
		return "username:" + getUsername() + "|name=" + getName();
	}

	public String getStateStr() {
		return stateStr;
	}

	public void setStateStr(String stateStr) {
		this.stateStr = stateStr;
	}

	public void buildTable() {
		stateStr = DictMap.value(DictMap.KEY_USER_STATUS, getState());
	}
}
